package cn.wzvtcsoft.sys.security.rbac.authorize;

import com.chentongwei.security.core.authorize.AuthorizeConfigProvider;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.stereotype.Component;

/**
 * @author swxu_2005@163.com
 */
@Component
@Order(Integer.MAX_VALUE)
public class RbacAuthorizeConfigProvider implements AuthorizeConfigProvider {
  @Override
  public void config(HttpSecurity httpSecurity) throws Exception {
    httpSecurity.authorizeRequests().anyRequest().access("@rbacService.hasPermission(request,authentication)");
  }
}
